3.5.60 \(\int \frac {\cos ^2(c+d x)}{a+b \tan ^2(c+d x)} \, dx\) [460]

Optimal. Leaf size=83 \[ \frac {(a-3 b) x}{2 (a-b)^2}+\frac {b^{3/2} \text {ArcTan}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} (a-b)^2 d}+\frac {\cos (c+d x) \sin (c+d x)}{2 (a-b) d} \]

[Out]

1/2*(a-3*b)*x/(a-b)^2+1/2*cos(d*x+c)*sin(d*x+c)/(a-b)/d+b^(3/2)*arctan(b^(1/2)*tan(d*x+c)/a^(1/2))/(a-b)^2/d/a
^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 83, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3756, 425, 536, 209, 211} \begin {gather*} \frac {b^{3/2} \text {ArcTan}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} d (a-b)^2}+\frac {\sin (c+d x) \cos (c+d x)}{2 d (a-b)}+\frac {x (a-3 b)}{2 (a-b)^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2/(a + b*Tan[c + d*x]^2),x]

[Out]

((a - 3*b)*x)/(2*(a - b)^2) + (b^(3/2)*ArcTan[(Sqrt[b]*Tan[c + d*x])/Sqrt[a]])/(Sqrt[a]*(a - b)^2*d) + (Cos[c
+ d*x]*Sin[c + d*x])/(2*(a - b)*d)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 425

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[(-b)*x*(a + b*x^n)^(p + 1)*
((c + d*x^n)^(q + 1)/(a*n*(p + 1)*(b*c - a*d))), x] + Dist[1/(a*n*(p + 1)*(b*c - a*d)), Int[(a + b*x^n)^(p + 1
)*(c + d*x^n)^q*Simp[b*c + n*(p + 1)*(b*c - a*d) + d*b*(n*(p + q + 2) + 1)*x^n, x], x], x] /; FreeQ[{a, b, c,
d, n, q}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] &&  !( !IntegerQ[p] && IntegerQ[q] && LtQ[q, -1]) && IntBinomi
alQ[a, b, c, d, n, p, q, x]

Rule 536

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 3756

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps

\begin {align*} \int \frac {\cos ^2(c+d x)}{a+b \tan ^2(c+d x)} \, dx &=\frac {\text {Subst}\left (\int \frac {1}{\left (1+x^2\right )^2 \left (a+b x^2\right )} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {\cos (c+d x) \sin (c+d x)}{2 (a-b) d}-\frac {\text {Subst}\left (\int \frac {-a+2 b-b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (c+d x)\right )}{2 (a-b) d}\\ &=\frac {\cos (c+d x) \sin (c+d x)}{2 (a-b) d}+\frac {(a-3 b) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{2 (a-b)^2 d}+\frac {b^2 \text {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tan (c+d x)\right )}{(a-b)^2 d}\\ &=\frac {(a-3 b) x}{2 (a-b)^2}+\frac {b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} (a-b)^2 d}+\frac {\cos (c+d x) \sin (c+d x)}{2 (a-b) d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.12, size = 78, normalized size = 0.94 \begin {gather*} \frac {4 b^{3/2} \text {ArcTan}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )+\sqrt {a} (2 (a-3 b) (c+d x)+(a-b) \sin (2 (c+d x)))}{4 \sqrt {a} (a-b)^2 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2/(a + b*Tan[c + d*x]^2),x]

[Out]

(4*b^(3/2)*ArcTan[(Sqrt[b]*Tan[c + d*x])/Sqrt[a]] + Sqrt[a]*(2*(a - 3*b)*(c + d*x) + (a - b)*Sin[2*(c + d*x)])
)/(4*Sqrt[a]*(a - b)^2*d)

________________________________________________________________________________________

Maple [A]
time = 0.40, size = 85, normalized size = 1.02

method result size
derivativedivides \(\frac {\frac {b^{2} \arctan \left (\frac {b \tan \left (d x +c \right )}{\sqrt {a b}}\right )}{\left (a -b \right )^{2} \sqrt {a b}}+\frac {\frac {\left (\frac {a}{2}-\frac {b}{2}\right ) \tan \left (d x +c \right )}{1+\tan ^{2}\left (d x +c \right )}+\frac {\left (a -3 b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{2}}{\left (a -b \right )^{2}}}{d}\) \(85\)
default \(\frac {\frac {b^{2} \arctan \left (\frac {b \tan \left (d x +c \right )}{\sqrt {a b}}\right )}{\left (a -b \right )^{2} \sqrt {a b}}+\frac {\frac {\left (\frac {a}{2}-\frac {b}{2}\right ) \tan \left (d x +c \right )}{1+\tan ^{2}\left (d x +c \right )}+\frac {\left (a -3 b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{2}}{\left (a -b \right )^{2}}}{d}\) \(85\)
risch \(\frac {x a}{2 \left (a -b \right )^{2}}-\frac {3 x b}{2 \left (a -b \right )^{2}}-\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{8 \left (a -b \right ) d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )}}{8 \left (a -b \right ) d}+\frac {\sqrt {-a b}\, b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-a b}-a -b}{a -b}\right )}{2 a \left (a -b \right )^{2} d}-\frac {\sqrt {-a b}\, b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-a b}+a +b}{a -b}\right )}{2 a \left (a -b \right )^{2} d}\) \(179\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2/(a+b*tan(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(b^2/(a-b)^2/(a*b)^(1/2)*arctan(b*tan(d*x+c)/(a*b)^(1/2))+1/(a-b)^2*((1/2*a-1/2*b)*tan(d*x+c)/(1+tan(d*x+c
)^2)+1/2*(a-3*b)*arctan(tan(d*x+c))))

________________________________________________________________________________________

Maxima [A]
time = 0.52, size = 95, normalized size = 1.14 \begin {gather*} \frac {\frac {2 \, b^{2} \arctan \left (\frac {b \tan \left (d x + c\right )}{\sqrt {a b}}\right )}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \sqrt {a b}} + \frac {{\left (d x + c\right )} {\left (a - 3 \, b\right )}}{a^{2} - 2 \, a b + b^{2}} + \frac {\tan \left (d x + c\right )}{{\left (a - b\right )} \tan \left (d x + c\right )^{2} + a - b}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+b*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*(2*b^2*arctan(b*tan(d*x + c)/sqrt(a*b))/((a^2 - 2*a*b + b^2)*sqrt(a*b)) + (d*x + c)*(a - 3*b)/(a^2 - 2*a*b
 + b^2) + tan(d*x + c)/((a - b)*tan(d*x + c)^2 + a - b))/d

________________________________________________________________________________________

Fricas [A]
time = 2.31, size = 290, normalized size = 3.49 \begin {gather*} \left [\frac {2 \, {\left (a - 3 \, b\right )} d x + 2 \, {\left (a - b\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \sqrt {-\frac {b}{a}} \log \left (\frac {{\left (a^{2} + 6 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{4} - 2 \, {\left (3 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} - 4 \, {\left ({\left (a^{2} + a b\right )} \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \sqrt {-\frac {b}{a}} \sin \left (d x + c\right ) + b^{2}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{4} + 2 \, {\left (a b - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right )}{4 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} d}, \frac {{\left (a - 3 \, b\right )} d x + {\left (a - b\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) - b \sqrt {\frac {b}{a}} \arctan \left (\frac {{\left ({\left (a + b\right )} \cos \left (d x + c\right )^{2} - b\right )} \sqrt {\frac {b}{a}}}{2 \, b \cos \left (d x + c\right ) \sin \left (d x + c\right )}\right )}{2 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} d}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+b*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

[1/4*(2*(a - 3*b)*d*x + 2*(a - b)*cos(d*x + c)*sin(d*x + c) + b*sqrt(-b/a)*log(((a^2 + 6*a*b + b^2)*cos(d*x +
c)^4 - 2*(3*a*b + b^2)*cos(d*x + c)^2 - 4*((a^2 + a*b)*cos(d*x + c)^3 - a*b*cos(d*x + c))*sqrt(-b/a)*sin(d*x +
 c) + b^2)/((a^2 - 2*a*b + b^2)*cos(d*x + c)^4 + 2*(a*b - b^2)*cos(d*x + c)^2 + b^2)))/((a^2 - 2*a*b + b^2)*d)
, 1/2*((a - 3*b)*d*x + (a - b)*cos(d*x + c)*sin(d*x + c) - b*sqrt(b/a)*arctan(1/2*((a + b)*cos(d*x + c)^2 - b)
*sqrt(b/a)/(b*cos(d*x + c)*sin(d*x + c))))/((a^2 - 2*a*b + b^2)*d)]

________________________________________________________________________________________

Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2/(a+b*tan(d*x+c)**2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]
time = 0.64, size = 110, normalized size = 1.33 \begin {gather*} \frac {\frac {2 \, {\left (\pi \left \lfloor \frac {d x + c}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (d x + c\right )}{\sqrt {a b}}\right )\right )} b^{2}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \sqrt {a b}} + \frac {{\left (d x + c\right )} {\left (a - 3 \, b\right )}}{a^{2} - 2 \, a b + b^{2}} + \frac {\tan \left (d x + c\right )}{{\left (\tan \left (d x + c\right )^{2} + 1\right )} {\left (a - b\right )}}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+b*tan(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(2*(pi*floor((d*x + c)/pi + 1/2)*sgn(b) + arctan(b*tan(d*x + c)/sqrt(a*b)))*b^2/((a^2 - 2*a*b + b^2)*sqrt(
a*b)) + (d*x + c)*(a - 3*b)/(a^2 - 2*a*b + b^2) + tan(d*x + c)/((tan(d*x + c)^2 + 1)*(a - b)))/d

________________________________________________________________________________________

Mupad [B]
time = 13.89, size = 254, normalized size = 3.06 \begin {gather*} -\frac {6\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (c+d\,x\right )}{\cos \left (c+d\,x\right )}\right )-a^2\,\sin \left (2\,c+2\,d\,x\right )-2\,a^2\,\mathrm {atan}\left (\frac {\sin \left (c+d\,x\right )}{\cos \left (c+d\,x\right )}\right )+a\,b\,\sin \left (2\,c+2\,d\,x\right )+\mathrm {atan}\left (\frac {a^2\,b^3\,\sin \left (c+d\,x\right )\,\sqrt {-a\,b^3}\,9{}\mathrm {i}-a^3\,b^2\,\sin \left (c+d\,x\right )\,\sqrt {-a\,b^3}\,6{}\mathrm {i}-a\,b^4\,\sin \left (c+d\,x\right )\,\sqrt {-a\,b^3}\,4{}\mathrm {i}+a^4\,b\,\sin \left (c+d\,x\right )\,\sqrt {-a\,b^3}\,1{}\mathrm {i}}{-\cos \left (c+d\,x\right )\,a^5\,b^2+6\,\cos \left (c+d\,x\right )\,a^4\,b^3-9\,\cos \left (c+d\,x\right )\,a^3\,b^4+4\,\cos \left (c+d\,x\right )\,a^2\,b^5}\right )\,\sqrt {-a\,b^3}\,4{}\mathrm {i}}{4\,d\,a^3-8\,d\,a^2\,b+4\,d\,a\,b^2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2/(a + b*tan(c + d*x)^2),x)

[Out]

-(atan((a^2*b^3*sin(c + d*x)*(-a*b^3)^(1/2)*9i - a^3*b^2*sin(c + d*x)*(-a*b^3)^(1/2)*6i - a*b^4*sin(c + d*x)*(
-a*b^3)^(1/2)*4i + a^4*b*sin(c + d*x)*(-a*b^3)^(1/2)*1i)/(4*a^2*b^5*cos(c + d*x) - 9*a^3*b^4*cos(c + d*x) + 6*
a^4*b^3*cos(c + d*x) - a^5*b^2*cos(c + d*x)))*(-a*b^3)^(1/2)*4i - 2*a^2*atan(sin(c + d*x)/cos(c + d*x)) - a^2*
sin(2*c + 2*d*x) + 6*a*b*atan(sin(c + d*x)/cos(c + d*x)) + a*b*sin(2*c + 2*d*x))/(4*a^3*d + 4*a*b^2*d - 8*a^2*
b*d)

________________________________________________________________________________________